package lesson05;

public class SingletonLazy {
    private volatile   static  SingletonLazy s=null;
    private  SingletonLazy(){}

    public static  SingletonLazy getSingletonLazy(){
        //判断一下是否加锁，节省锁资源
            if(s==null)
                synchronized (String.class) {
                    s = s == null ? new SingletonLazy() : s;
                }
        return s;
    }
}
